proses Import image
library(EBImage)
Image <- readImage("D:/Rmarkdown/analisisEBimage/foto2.jpg")
print(Image)
## Image
## colorMode : Color
## storage.mode : double
## dim : 1546 870 3
## frames.total : 3
## frames.render: 1
##
## imageData(object)[1:5,1:6,1]
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 0.0000000 0.0000000 0.06274510 0.10588235 0.12156863 0.06274510
## [2,] 0.0000000 0.0000000 0.06274510 0.14117647 0.13725490 0.10196078
## [3,] 0.3098039 0.1215686 0.02352941 0.10980392 0.12156863 0.10588235
## [4,] 0.6784314 0.6627451 0.02352941 0.12549020 0.14901961 0.12941176
## [5,] 0.6509804 0.6627451 0.05882353 0.06666667 0.09411765 0.06666667
display(Image)
menyesuaikan kecerahan
Image1 <- Image + 0.2
Image2 <- Image - 0.2
par(mfrow= c(1,2))
plot(Image1)
plot(Image2)
memanipulasi kontras
Image3 <- Image * 0.5
Image4 <- Image * 2
par(mfrow= c(1,2))
plot(Image3)
plot(Image4)
koreksi Gamma
Image5 <- Image ^ 2
Image6 <- Image ^ 0.7
par(mfrow= c(1,2))
plot(Image5)
plot(Image6)
#Cropping
display(Image[189:1000, 100:600,])
#Transformasi Spasial
Imagetr <- translate(rotate(Image, 45), c(50,0))
display(Imagetr)
#Manajemen warna
colorMode(Image) <- Grayscale
display(Image)
## Only the first frame of the image stack is displayed.
## To display all frames use 'all = TRUE'.
print(Image)
## Image
## colorMode : Grayscale
## storage.mode : double
## dim : 1546 870 3
## frames.total : 3
## frames.render: 3
##
## imageData(object)[1:5,1:6,1]
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 0.0000000 0.0000000 0.06274510 0.10588235 0.12156863 0.06274510
## [2,] 0.0000000 0.0000000 0.06274510 0.14117647 0.13725490 0.10196078
## [3,] 0.3098039 0.1215686 0.02352941 0.10980392 0.12156863 0.10588235
## [4,] 0.6784314 0.6627451 0.02352941 0.12549020 0.14901961 0.12941176
## [5,] 0.6509804 0.6627451 0.05882353 0.06666667 0.09411765 0.06666667
colorMode(Image) <- Color
display(Image)
#low-pass filter
flow <- makeBrush(21, shape= 'disc', step=FALSE)^2
flow <- flow/sum(flow)
Image.flow <- filter2(Image, flow)
display(Image.flow)
#high-pass filter
fHigh <- matrix(1, nc=3, nr=3)
fHigh[2,2]<- -8
Image.fHigh <- filter2(Image, fHigh)
display(Image.fHigh)
daftar pustaka : https://thinkstudioo.blogspot.com/2018/03/analisis-image-menggunakan-ebimage-di-r_6.html